//
// Created by wze-zero on 2024/9/5 005.
//
#include <iostream>
#include <iomanip>

using namespace std;

int main() {
    double val;
    int month, day, ticket;
    cin >> val >> month >> day >> ticket;
    if (month == 11 && day == 11) {
        val *= 0.7;
        ticket == 1 ? val -= 50 : val = val;
    } else if (month == 12 && day == 12) {
        val *= 0.8;
        ticket == 1 ? val -= 50 : val = val;
    } else {
        val = val;
    }
    val = val > 0 ? val : 0;
    cout << fixed << setprecision(2) << val << endl;
    return 0;
}